<html>
<head><meta charset="utf-8"><title>lib-std-on-tvos · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html">lib-std-on-tvos</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="243795485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/243795485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hindrik Stegenga <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#243795485">(Jun 24 2021 at 14:37)</a>:</h4>
<p>Hello everyone!<br>
I am wondering what exactly would be necessary in order to get libstd working on tvOS? I already forked the compiler+libc and made some changes to the sources of libc and std, mostly changing cfg(platform) stuff since iOS is very very similar to tvOS, and while it compiles, the outputted library is apparently a macOS library file. (Although it is arm64 arch). What exactly is necessary to get std to work on an unsupported os?</p>



<a name="243874302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/243874302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#243874302">(Jun 25 2021 at 04:24)</a>:</h4>
<p>I am not familiar with the intricacies of the Apple ecosystem and compiling for it, but based on that limited information I would hazard a guess your issue is not in libstd but in the need to educate the compiler itself about your target as well, including possibly defining a <a href="https://docs.rust-embedded.org/embedonomicon/custom-target.html">https://docs.rust-embedded.org/embedonomicon/custom-target.html</a> or even editing the compiler source's handling of Apple stuff inside it.</p>
<p>That, or you need to provide more information on what exactly you've done so far. ^^;</p>



<a name="243875995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/243875995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#243875995">(Jun 25 2021 at 05:03)</a>:</h4>
<p>the target should already exist (actually, multiple targets — <code>x86_64-apple-tvos</code> for the simulator, and <code>aarch64-apple-tvos</code> for the actual device). that said i dont think these get a lot of testing, and may need someone to dust them off</p>



<a name="243877572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/243877572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#243877572">(Jun 25 2021 at 05:39)</a>:</h4>
<p>ahhhh.</p>



<a name="244387022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/244387022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hindrik Stegenga <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#244387022">(Jun 30 2021 at 07:35)</a>:</h4>
<p>Yes, I can compile code for no-std, with a custom build of the compiler, but I am trying to figure out how exactly and what is necessary to add support for compiling std. I already hacked around in libc/std, as the iOS APIs are very very close to tvOS, so most of all the c based function interfaces can be direct ports, but I am not completely sure what exactly is necessary besides that. I basically just added #cfg platform=tvOS attributes to all places where there is ios code. It seemed I could get stuff to compile... somewhat and with a lot of hackery to get my custom libc/std working. It still doesn't quite work for me, as it doesn't recognize the outputted library format for example. So I am wondering what the normal process is for adding support to libc/std?</p>



<a name="244396898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/244396898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#244396898">(Jun 30 2021 at 09:23)</a>:</h4>
<p>That sounds like a bug honestly.</p>



<a name="244396960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/244396960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#244396960">(Jun 30 2021 at 09:24)</a>:</h4>
<p>Unfortunataely, IDK who has the expertise here to help you track it down</p>



<a name="244399345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/244399345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hindrik Stegenga <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#244399345">(Jun 30 2021 at 09:46)</a>:</h4>
<p>Hmm, do you know where it's specified in what format exactly libraries are compiled and what libc implementation is linked to?</p>



<a name="244400193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/244400193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#244400193">(Jun 30 2021 at 09:55)</a>:</h4>
<p>you might ask in <a class="stream" data-stream-id="182449" href="/#narrow/stream/182449-t-compiler.2Fhelp">#t-compiler/help</a></p>



<a name="244451906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/244451906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> XAMPPRocky <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#244451906">(Jun 30 2021 at 16:35)</a>:</h4>
<p><span class="user-mention" data-user-id="374054">@Hindrik Stegenga</span> Anything that only touches a Darwin API would probably be better cfg’ed under <code>target_vendor = “apple”</code> in my opinion, all Apple devices run Darwin under the hood. For linking libraries look at std’s <code>build.rs</code></p>



<a name="244467667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/244467667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#244467667">(Jun 30 2021 at 18:25)</a>:</h4>
<p>I've done this in the past, but it makes some assumptions about apples future product line that seem dubious. It's pretty clearly a standin for some sort of <code>cfg(target_family = "darwin")</code> too (which I still think we should do — although it would have to still accept <code>target_family = "unix"</code> too — so it would make target_family be a multi-valued cfg...)</p>



<a name="244470715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/244470715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> XAMPPRocky <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#244470715">(Jun 30 2021 at 18:49)</a>:</h4>
<p><span class="user-mention" data-user-id="209168">@Thom Chiovoloni</span> I believe target family is already multi-value (just added during the last release cycle.)</p>



<a name="244471925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/244471925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#244471925">(Jun 30 2021 at 18:58)</a>:</h4>
<p>oh, that's exciting. darwin should be a target_family then, IMO</p>



<a name="244537272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/lib-std-on-tvos/near/244537272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hindrik Stegenga <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/lib-std-on-tvos.html#244537272">(Jul 01 2021 at 09:06)</a>:</h4>
<p>Hmm, interesting. I will dig into it a bit more then this weekend. Atleast it seems relatively easy to port libc/std as it only seems to require some #cfg_target_os changes. While I won't be able to build release ready libs, as bitcode support is enforced for app releases on apple tv, in theory, I should be able to build developer signed apps for my local device.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>